﻿using ActionGraph.Core;
using UnityEngine;

namespace ActionGraph.CustomNode
{
    public class CheckInputNode : ActionNode
    {
        [Input (ShowBackingValue.Never)] public byte        In;
        [Output]                         public byte        Main;
        [Output]                         public byte        Second;
        public                                  PlayerInput input;

        protected override bool OnExcute ()
        {
            var inputComp = GameManager.contexts.input.inputComp;
            if (input == PlayerInput.MainButton && inputComp.Fire)
            {
                ExitNode ("Main");
            }
            else if (input == PlayerInput.SecondButton && inputComp.SecondaryButton)
            {
                ExitNode ("Second");
            }
            return true;
        }
    }
}